package com.lzugis.controller;

import com.lzugis.common.R;
import com.lzugis.entity.SysUser;
import com.lzugis.service.ILoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @ClassName LoginController
 * @Author lzugis
 * @Date 2020/9/15 16:12
 **/
@Api(tags = "用户登录")
@RestController
@RequestMapping("login")
public class LoginController {

    @Autowired
    private ILoginService loginService;

    @ApiOperation("用户登录")
    @PostMapping("post")
    public R login(@RequestBody SysUser sysUser) {
        return loginService.login(sysUser) ? R.ok() : R.error("账号或密码错误！");
    }
}
